<%@ include file="IncludeTop.jsp" %>
<%@ taglib prefix="fn"     uri="http://java.sun.com/jsp/jstl/functions" %>

<table align="left" bgcolor="#008800" border="0" cellspacing="2" cellpadding="2">
<tr><td bgcolor="#FFFF88">
<a href="<c:url value="/shop/index.do"/>"><b><font color="BLACK" size="2">&lt;&lt; <fmt:message key="main.menu" /></font></b></a>
</td></tr>
<tr><td bgcolor="#FFFF88">
<%--
<html:link paramId="orderId" paramName="order" paramProperty="orderId" page="/shop/viewOrder.do?webservice=true"><b><font color="BLACK" size="2">Use Web Service</font></b></c:url>
--%>
</td></tr>
</table>

<c:if test="${!empty message}">
  <center><b><fmt:message key="${message}"/></b></center>
</c:if>

<p>

<table width="60%" align="center" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFF88">
<tr bgcolor="#FFFF88"><td align="center" colspan="2">
  <font size="4"><b><fmt:message key="order" /> #<c:out value="${order.orderId}"/></b></font>
  <br /><font size="3"><b><fmt:formatDate value="${order.orderDate}" pattern="yyyy/MM/dd hh:mm:ss" /></b></font>
</td></tr>
<tr bgcolor="#FFFF88"><td colspan="2">
<font color="GREEN" size="4"><b><fmt:message key="payment.details" /></b></font>
</td></tr>
<tr bgcolor="#FFFF88"><td>
<fmt:message key="card.type" />:</td><td>
<c:out value="${order.cardType}"/>
</td></tr>
<tr bgcolor="#FFFF88"><td>
<fmt:message key="card.number" />:</td><td><c:out value="${order.creditCard}"/> <font color="red" size="2">* <fmt:message key="fake.number" />!</font>
</td></tr>
<tr bgcolor="#FFFF88"><td>
<fmt:message key="expiry.date" /> (MM/YYYY):</td><td><c:out value="${order.expiryDate}"/>
</td></tr>
<tr bgcolor="#FFFF88"><td colspan="2">
<font color="GREEN" size="4"><b><fmt:message key="billing.address" /></b></font>
</td></tr>

<c:choose>
<c:when test="${fn:startsWith(localeImg, 'zh')}" >
<tr bgcolor="#FFFF88"><td>
<fmt:message key="last.name" />:</td><td><c:out value="${order.billToLastName}"/>
</td></tr>
<tr bgcolor="#FFFF88"><td>
<fmt:message key="first.name" />:</td><td><c:out value="${order.billToFirstName}"/>
</td></tr>
</c:when>
<c:otherwise>
<tr bgcolor="#FFFF88"><td>
<fmt:message key="first.name" />:</td><td><c:out value="${order.billToFirstName}"/>
</td></tr>
<tr bgcolor="#FFFF88"><td>
<fmt:message key="last.name" />:</td><td><c:out value="${order.billToLastName}"/>
</td></tr>
</c:otherwise>
</c:choose>

<tr bgcolor="#FFFF88"><td>
<fmt:message key="address.1" />:</td><td><c:out value="${order.billAddress1}"/>
</td></tr>
<tr bgcolor="#FFFF88"><td>
<fmt:message key="address.2" />:</td><td><c:out value="${order.billAddress2}"/>
</td></tr>
<tr bgcolor="#FFFF88"><td>
<fmt:message key="city" />: </td><td><c:out value="${order.billCity}"/>
</td></tr>
<tr bgcolor="#FFFF88"><td>
<fmt:message key="state" />:</td><td><c:out value="${order.billState}"/>
</td></tr>
<tr bgcolor="#FFFF88"><td>
<fmt:message key="zip" />:</td><td><c:out value="${order.billZip}"/>
</td></tr>
<tr bgcolor="#FFFF88"><td>
<fmt:message key="country" />: </td><td><c:out value="${order.billCountry}"/>
</td></tr>


<tr bgcolor="#FFFF88"><td colspan="2">
<font color="GREEN" size="4"><b><fmt:message key="shipping.address" /></b></font>
</td></tr>

<c:choose>
<c:when test="${fn:startsWith(localeImg, 'zh')}" >
<tr bgcolor="#FFFF88"><td>
<fmt:message key="last.name" />:</td><td><c:out value="${order.shipToLastName}"/>
</td></tr>
<tr bgcolor="#FFFF88"><td>
<fmt:message key="first.name" />:</td><td><c:out value="${order.shipToFirstName}"/>
</td></tr>
</c:when>
<c:otherwise>
<tr bgcolor="#FFFF88"><td>
<fmt:message key="first.name" />:</td><td><c:out value="${order.shipToFirstName}"/>
</td></tr>
<tr bgcolor="#FFFF88"><td>
<fmt:message key="last.name" />:</td><td><c:out value="${order.shipToLastName}"/>
</td></tr>
</c:otherwise>
</c:choose>

<tr bgcolor="#FFFF88"><td>
<fmt:message key="address.1" />:</td><td><c:out value="${order.shipAddress1}"/>
</td></tr>
<tr bgcolor="#FFFF88"><td>
<fmt:message key="address.2" />:</td><td><c:out value="${order.shipAddress2}"/>
</td></tr>
<tr bgcolor="#FFFF88"><td>
<fmt:message key="city" />: </td><td><c:out value="${order.shipCity}"/>
</td></tr>
<tr bgcolor="#FFFF88"><td>
<fmt:message key="state" />:</td><td><c:out value="${order.shipState}"/>
</td></tr>
<tr bgcolor="#FFFF88"><td>
<fmt:message key="zip" />:</td><td><c:out value="${order.shipZip}"/>
</td></tr>
<tr bgcolor="#FFFF88"><td>
<fmt:message key="country" />: </td><td><c:out value="${order.shipCountry}"/>
</td></tr>
<tr bgcolor="#FFFF88"><td>
<fmt:message key="courier" />: </td><td><c:out value="${order.courier}"/>
</td></tr>
<tr bgcolor="#FFFF88"><td colspan="2">
  <b><font color="GREEN" size="4"><fmt:message key="status" />:</font> <c:out value="${order.status}"/></b>
</td></tr>
<tr bgcolor="#FFFF88"><td colspan="2">
<table width="100%" align="center" bgcolor="#008800" border="0" cellspacing="2" cellpadding="3">
  <tr bgcolor="#CCCCCC">
  <td><b><fmt:message key="item.id" /></b></td>
  <td><b><fmt:message key="description" /></b></td>
  <td><b><fmt:message key="quantity" /></b></td>
  <td><b><fmt:message key="price" /></b></td>
  <td><b><fmt:message key="total.price" /></b></td>
  </tr>
<c:forEach var="lineItem" items="${order.lineItems}">
  <tr bgcolor="#FFFF88">
  <td><b><a href="<c:url value="/shop/viewItem.do"><c:param name="itemId" value="${lineItem.itemId}"/></c:url>">
    <font color="BLACK"><c:out value="${lineItem.itemId}"/></font>
  </a></b></td>
  <td>
    <c:out value="${lineItem.item.attribute1}"/>
    <c:out value="${lineItem.item.attribute2}"/>
    <c:out value="${lineItem.item.attribute3}"/>
    <c:out value="${lineItem.item.attribute4}"/>
    <c:out value="${lineItem.item.attribute5}"/>
    <c:out value="${lineItem.item.product.name}"/>
<c:if test="${fn:startsWith(localeImg, 'zh')}" >
    (<fmt:message key="${fn:replace(lineItem.item.product.name, ' ', '.')}" />)
</c:if>
  </td>
  <td><c:out value="${lineItem.quantity}"/></td>
  <td align="right"><fmt:formatNumber value="${lineItem.unitPrice}" pattern="$#,##0.00"/></td>
  <td align="right"><fmt:formatNumber value="${lineItem.totalPrice}" pattern="$#,##0.00"/></td>
  </tr>
</c:forEach>
  <tr bgcolor="#FFFF88">
  <td colspan="5" align="right"><b><fmt:message key="total" />: <fmt:formatNumber value="${order.totalPrice}" pattern="$#,##0.00"/></b></td>
  </tr>
</table>
</td></tr>

</table>

<%@ include file="IncludeBottom.jsp" %>
